package org.hugh.space.business.impl;

import java.io.Serializable;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.hugh.space.business.Business;
import org.hugh.space.business.UserPreferences;

public class BusinessImpl  implements Business, Serializable {
	
	@Override
	public UserPreferences getUserPreferences(final HttpServletRequest request) {
		String name = UserPreferences.class.getName();
		HttpSession session = request.getSession(true);
		if (session.getAttribute(name) == null) {
			session.setAttribute(name, new UserPreferences());
		}
		return (UserPreferences)session.getAttribute(name);
	}

	@Override
	public void setUserPreferences(UserPreferences bean, 
			final HttpServletRequest request) {
		String name = UserPreferences.class.getName();
		HttpSession session = request.getSession(true);
		session.setAttribute(name, bean);
	}

	public void init(){
		
	}
}
